Make the EventLoopWindowTarget passed to the EventLoop::run callback live for 'static#2346
Closed
Liamolucko wants to merge 12 commits intorust-windowing:masterfrom
Closed
Make the EventLoopWindowTarget passed to the EventLoop::run callback live for 'static#2346Liamolucko wants to merge 12 commits intorust-windowing:masterfrom
EventLoopWindowTarget passed to the EventLoop::run callback live for 'static#2346Liamolucko wants to merge 12 commits intorust-windowing:masterfrom
Conversation
clippy appeasal
madsmtm
requested changes
Feb 27, 2024
Member
There was a problem hiding this comment.
GitHub gave me a ping on this for some reason?
Anyhow, I'm gonna have to reject this change; we're actively trying to get the codebase in a spot where the EventLoopWindowTarget (now ActiveEventLoop) is specifically not static, but rather an &mut reference to internal data, and which might change upon each iteration.
The main motivation for this is writing an async executor on top of winit
I believe this may already have been done in async-winit?
In any case, the way to solve this would be via. message-passing and by waking the event loop, and letting it process things in there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGELOG.mdif knowledge of this change could be valuable to usersUpdated documentation to reflect any user-facing changes, including notes of platform-specific behaviorthis is purely a signature change, so no extra docs are needed on top.Created or updated an example program if it would help users understand this functionalityUpdated feature matrix, if new features were added or implementedThis PR changes the signature of
EventLoop::runto make theEventLoopWindowTargetpassed to the callback live for'static, and changes the signature ofEventLoop::run_returnto make theEventLoopWindowTargetlive for as long as the reference to the event loop.The main motivation for this is writing an async executor on top of winit (ref #1199). Such an executor needs to pass an
EventLoopWindowTargetto the future to create windows with, which then needs to live for the entirety of the future (i.e.,'static).This plus #2294 should make it possible to write an async executor on top of winit.